function [res] = formatValues(values, varargin)
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Inputs:
	% values:					dim1 x dim2
	% varargin{1}=std_devs:		dim1 x dim2
	% varargin{2}=NumDigitsAfterComma:	integer >= 0
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Outputs:
	% res:						cell(dim1, dim2)
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	% Read optional arguments
	if nargin >= 2
		std_devs = varargin{1};
	else
		std_devs = [];
	end
	if nargin >= 3
		NumDigitsAfterComma = varargin{2};
	else
		NumDigitsAfterComma = {};
	end
	
	% Read dimensions
	dim1 = size(values, 1);
	dim2 = size(values, 2);
	
	% Prepare output and iterate through values
	res = cell(dim1, dim2);
	for d2 = 1:dim2
		for d1 = 1:dim1
			res_dd = formatNumber(values(d1,d2), false, NumDigitsAfterComma);
			if ~isempty(std_devs)
				std_dev_dd = formatNumber(std_devs(d1,d2), true, NumDigitsAfterComma);
				res_dd = sprintf('%s %s', res_dd, std_dev_dd);
			end
			res{d1,d2} = res_dd;
		end
	end
end
